#include<d3dx9.h>
#include "head.h"


int WINAPI WinMain(
	HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR nCmdLine,
	int nCmdShow
)
{
	static MSG msg;
	RegClass(hInstance, "MainClass", nullptr, MainWindowProc);
	HWND hWnd = CreateWindow("MainClass", "MainWindow", WS_OVERLAPPEDWINDOW, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, nullptr, nullptr, hInstance, nullptr);
	ShowWindow(hWnd, SW_SHOW);
	InitD3D(hWnd);
	UpdateWindow(hWnd);
	while (1)
	{
		PeekMessage(&msg,nullptr,0,0,PM_REMOVE);
		if (msg.message == WM_QUIT)return 0;
		TranslateMessage(&msg);
		DispatchMessage(&msg);
		RenderFrame();
	}
	ClearD3D();
	return msg.wParam;
}